package hvzt.minimap.activities.mapItems;

import iface.HvZUser;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.OverlayItem;

/**
 * Extends OverlayItem to hold a HvZUser
 * @author JakeS
 *
 */
public class PlayerOverlay extends OverlayItem {
	private static final double LOC_ADJUSTMENT = 1E6;
	private HvZUser user;
	
	/**
	 * Constructs a PersonOverlay from the given HvZUser, such that
	 * getTitle() returns the user's username, getSnippet() returns the user's
	 * phone # and getPoint() returns a GeoPoint based on the user's Location, where
	 * the latitude and longitude are converted into microdegrees (deg * 10^6).
	 * @param user the HvZUser to construct a PersonOverlay from
	 */
	public PlayerOverlay(HvZUser user){
		// this is complicated because of stupid java
		super(new GeoPoint(
				(int)(user.getLocation().getLat() * LOC_ADJUSTMENT),
				(int)(user.getLocation().getLong() * LOC_ADJUSTMENT)),
				user.getUsername(),
				user.getPhone());
		this.user = user;
	}
	
	/**
	 * @return the HvZUser used to construct the PersonOverlay
	 */
	public HvZUser getUser(){
		return user;
	}
}
